import java.math.BigInteger;


public class Stmt implements Node{
	public String token = "<stmt>";
	public Node stmt;
			
	public Stmt(){
		int token = PSTree.Core_TK.getToken();
		//System.out.println(token);
		// if token = assign, if, loop, in, or out go to stmt_seq
		if(token != 5 && token != 8 && token != 10 &&token != 11  && token!= 32){
			System.out.println("Error: missing statement");
			System.exit(1);
		}
		else{		
			//skip stmt token
			// if 
			
			if(token == 5){
				PSTree.Core_TK.skipToken();
				this.stmt = new If();
			}
			// loop
			else if(token == 8){
				PSTree.Core_TK.skipToken();
				this.stmt = new Loop();
			}
			// in
			else if(token == 10){
				PSTree.Core_TK.skipToken();
				this.stmt = new In();
			}
			// out
			else if(token == 11){
				PSTree.Core_TK.skipToken();
				this.stmt = new Out();
			}
			else if(token == 32){
				this.stmt = new Assign();
			}
			
			token = PSTree.Core_TK.getToken();
			if(token != 12){
				System.out.println("Error: expecting \";\" token");
				System.exit(1);
			}
			// skip ; token
			PSTree.Core_TK.skipToken();
		}
		
	}

	@Override
	public void print(int indent) {
		this.stmt.print(indent);
		
	}

	
	public void execute() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public BigInteger intexecute() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean compexecute() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public String Stringexcec() {
		// TODO Auto-generated method stub
		return null;
	}
}
